package com.kimho.transit.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kimho.transit.domain.Transit;
import com.kimho.transit.persistence.TransitMapper;
@Service
public class TransitService {
	@Autowired
	private TransitMapper transitMapper;
	/**
	 * 获取物流信息
	 * @return
	 */
	public List<Transit> getTransitList(Map<String, Object> param) {
		return transitMapper.getTransitList(param);
	}
	public Long getTotal(Map<String, Object> param){
		return transitMapper.getTotal(param);
	}
	public List<Transit> getTransitdetList(Map<String, Object> param) {
		return transitMapper.getTransitdetList(param);
	}
	
	/**
	 * 新增物流订单
	 * @param user
	 * @param param
	 */
	@Transactional
	public void insertTransit(Transit Transit,Map<String,Object> param) {
		//新增物流
		transitMapper.insertTransit(Transit);
		
	}
	/**
	 * 删除物流
	 * @param param
	 */
	@Transactional
	public void deleteTransit(Map<String,Object> param) {
		String ids = (String)param.get("ids");
		String[] idsArray = ids.split(",");
		for(int i=0;i<idsArray.length;i++) {
			param.put("id", idsArray[i]);
			transitMapper.deleteTransit(param);
		}
	}
}
